<?php if (!defined('THINK_PATH')) exit();?><!-- $Id: goods_info.htm 17126 2010-04-23 10:30:26Z liuhui $ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ECSHOP 管理中心 - 添加新商品 </title>
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/Public/Admin/styles/general.css" rel="stylesheet" type="text/css" />
<link href="/Public/Admin/styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function charea(a) {
    var spans = ['general','detail','mix'];
    for(i=0;i<3;i++) {
        var o = document.getElementById(spans[i]+'-tab');
        var tb = document.getElementById(spans[i]+'-table');
        o.className = o.id==a+'-tab'?'tab-front':'tab-back';
        tb.style.display = tb.id==a+'-table'?'block':'none';
    }

}
</script>
</head>
<body>

<h1>
<span class="action-span"><a href="goods.php?act=list">商品列表</a></span>
<span class="action-span1"><a href="index.php?act=main">ECSHOP 管理中心</a> </span><span id="search_id" class="action-span1"> - 添加新商品 </span>
<div style="clear:both"></div>
</h1>

<!-- start goods form -->
<div class="tab-div">
    <!-- tab bar -->
    <div id="tabbar-div">
      <p>
        <span class="tab-front" id="general-tab" onclick="charea('general');">通用信息</span>
        <span class="tab-back" id="detail-tab" onclick="charea('detail');">详细描述</span>
        <span class="tab-back" id="mix-tab" onclick="charea('mix');">其他信息</span>

      </p>
    </div>

    <!-- tab body -->
    <div id="tabbody-div">
      <form enctype="multipart/form-data" action="" method="post" name="theForm" >
        <!-- 最大文件限制 -->
        <input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
        <!-- 通用信息 -->
        <table width="90%" id="general-table" align="center">
          <tr>
            <td class="label">商品名称：</td>
            <td><input type="text" name="goods_name" value="<?php echo ($goodsdata['goods_name']); ?>" style="float:left;color:;" size="30" /></td>
          </tr>
          <tr>
            <td class="label">
            <a href="#" title="点击此处查看提示信息"><img src="/Public/Admin/images/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息"></a> 商品货号： </td>
            <td><input type="text" name="goods_sn" value="<?php echo ($goodsdata['goods_sn']); ?>" size="20"  /><span id="goods_sn_notice"></span><br />
            <span class="notice-span" style="display:block"  id="noticeGoodsSN">如果您不输入商品货号，系统将自动生成一个唯一的货号。</span></td>
          </tr>
          <tr>
            <td class="label">商品分类：</td>
            <td>
                <select name="cat_id"  >
                    <option value="0">请选择...</option>
                    <?php if(is_array($alist)): foreach($alist as $key=>$vo): ?><option value="<?php echo ($vo["cat_id"]); ?>" ><?php echo ($vo["lv"]); echo ($vo["cat_name"]); ?></option><?php endforeach; endif; ?>
                </select>
             </td>
          </tr>
                   <tr>
            <td class="label">本店售价：</td>
            <td><input type="text" name="shop_price" value="<?php echo ($goodsdata['shop_price']); ?>" size="20" /></td>
          </tr>

          <tr>
            <td class="label">上传商品图片：</td>

            <td>
              <input type="text" name = 'goods_img' value="<?php echo ($goodsdata['goods_img']); ?>" id='goods_img'><input type="file" id='goods_img1' name="goods_img1" size="35" /><button id='btn2'>提交</button>
                <div id='imgimg'></div>
            </td>
            <script>
            var fom = document.getElementsByTagName('form')[0];
            var btn2 = document.getElementById('btn2');
            var goods_img1 = document.getElementById('goods_img1');
            var goods_img = document.getElementById('goods_img');
            var imgimg = document.getElementById('imgimg');
                btn2.onclick = function () {
                    var fmdata = new FormData(fom); //FormData
                    var xhr = new XMLHttpRequest();
                    xhr.onreadystatechange = function () {
                    if (this.readyState == 4) {
                        var source = this.responseText;
                        var sou = eval('('+source+')');
                        goods_img.value = sou.path;
                        imgimg.innerHTML = '缩略图预览 <img src=/tianlang/Uploads/'+sou.path+'>';
                    }
                    }
                    xhr.open('post','/tianlang/index.php/Admin/Upload/upload',true);
                    xhr.send(fmdata);
                    return false;
                }

            </script>

          </tr>
        </table>

        <!-- 详细描述 -->
        <table width="90%" id="detail-table" style="display:none">
          <tr>
            <td><textarea name="goods_desc"><?php echo ($goodsdata['goods_desc']); ?></textarea></td>
          </tr>
        </table>

        <!-- 其他信息 -->
        <table width="90%" id="mix-table" style="display:none" align="center">
                    <tr>
            <td class="label">商品重量：</td>
            <td><input type="text" name="goods_weight"  value="<?php echo ($goodsdata['goods_weight']); ?>" size="20" /> <select name="weight_unit"><option value="1" selected>千克</option><option value="0.001">克</option></select></td>
          </tr>
          <tr>
            <td class="label"><a href="#" title="点击此处查看提示信息"><img src="/Public/Admin/images/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息"></a> 商品库存数量：</td>

            <td><input type="text" name="goods_number" value="<?php echo ($goodsdata['goods_number']); ?>" size="20" />
          </tr>
                    <tr>
            <td class="label">加入推荐：</td>
            <td><input type="checkbox" name="is_best" value="1" <?php if($goodsdata['is_best'] == 1): ?>checked='checked'<?php endif; ?> />精品 <input type="checkbox" name="is_new" value="1" <?php if($goodsdata['is_new'] == 1): ?>checked='checked'<?php endif; ?> />新品 <input type="checkbox" name="is_hot" <?php if($goodsdata['is_hot'] == 1): ?>checked='checked'<?php endif; ?> value="1"  />热销</td>
          </tr>
          <tr id="alone_sale_1">
            <td class="label" id="alone_sale_2">上架：</td>
            <td id="alone_sale_3"><input type="checkbox" name="is_on_sale" value="1" <?php if($goodsdata['is_on_sale'] == 1): ?>checked='checked'<?php endif; ?> /> 打勾表示允许销售，否则不允许销售。</td>
          </tr>
          <tr>
            <td class="label">商品关键词：</td>
            <td><input type="text" name="keywords" value="<?php echo ($goodsdata['keywords']); ?>" size="40" /> 用空格分隔</td>
          </tr>
          <tr>
            <td class="label">商品简单描述：</td>
            <td><textarea name="goods_brief" cols="40" rows="3"><?php echo ($goodsdata['goods_brief']); ?></textarea></td>
          </tr>
          <tr>
            <td class="label">
            <a href="#" title="点击此处查看提示信息"><img src="/Public/Admin/images/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息"></a> 商家备注： </td>
            <td><textarea name="seller_note" cols="40" rows="3"></textarea><br />
            <span class="notice-span" style="display:block"  id="noticeSellerNote">仅供商家自己看的信息</span></td>
          </tr>
        </table>


        <div class="button-div">
          <input type="hidden" name="goods_id" value="<?php echo ($goodsdata['goods_id']); ?>" />
                    <input type="submit" value=" 确定 " class="button" />
          <input type="reset" value=" 重置 " class="button" />
        </div>
        <input type="hidden" name="act" value="insert" />
      </form>
    </div>
</div>
<!-- end goods form -->

</body>
</html>